/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
 * main.cc
 * Copyright (C) 2012 César <cvergara@HP-430-CVG>
 * 
 * offside is free software: you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * offside is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License along
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <iostream>
#include <string>
#include <stdio.h>
/*Cv3rgara*/
using namespace std;

bool verficarOffSide(int nroDefensas, int nroAtacantes){
	
	if(nroDefensas > 0 && nroDefensas < 11 && nroAtacantes > 0 && nroAtacantes < 11){
		int defensas[nroDefensas], atacantes[nroAtacantes];
		
		int ultDef; //distancia del utlimo defensa
		int cont1;
		for (cont1 = 0 ; cont1 < nroDefensas ; cont1 ++){
			cout << "Ingrese la distancia del defensa" << endl;
			cin >> defensas[cont1];
			
		}

		for (cont1 = 0 ; cont1 < nroAtacantes ; cont1 ++){
			cout << "Ingrese la distancia del atacante" << endl;
			cin >> atacantes[cont1];
		}

		ultDef = defensas[0];

		for ( cont1 =1 ; cont1 < nroDefensas ; cont1++) {
			if(ultDef<defensas[cont1]){
				ultDef = defensas[cont1];
			}

		}

		for ( cont1 = 0 ; cont1 < nroAtacantes ; cont1++){
			if(atacantes[cont1]>ultDef){
				return true;
			}
		}
		
	}

	return false;
	
}



int main()
{   
	int cantDeff, cantAtacantes;
	cout << "ingrese la cantidad de defensas" << endl;
	cin >> cantDeff;
	cout << "ingrese la cantidad de atacantes" << endl;
	cin >> cantAtacantes;
	
	bool offside = verficarOffSide(cantDeff,cantAtacantes);

	if (offside == true){
		cout << "existe offside" << endl;
	}else{
		cout << "no existe offside" << endl;
	}
	
	return 0;
}
